package org.bling.star.server.configuration;

import org.bling.star.common.enums.EnvironmentConstant;
import org.apache.commons.configuration2.Configuration;
import org.apache.commons.configuration2.builder.fluent.Configurations;
import org.apache.commons.configuration2.ex.ConfigurationException;
import org.slf4j.Logger;

public class ServerConfiguration {

    private static final Logger log = org.slf4j.LoggerFactory.getLogger(ServerConfiguration.class);
    private String multiplyServer;
    private static final Configurations configs = new Configurations();
    private static Configuration defaultConfiguration;
    static {
        try {
            defaultConfiguration = configs.properties("application.properties");
        } catch (ConfigurationException e) {
            log.error("defaultConfiguration is missing");
        }
    }
    /**
     *  @see EnvironmentConstant
     */
    public static <T> T getConfig(String key,Class<T> clazz) {
        return defaultConfiguration.get(clazz, key);
    }

}

